﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Uc_Master_Header : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitMenu();
            InitCart();
        }
    }
    private void InitMenu()
    {
        menu.InnerHtml = HeaderViewer.InitMenu();
    }
    private void InitCart()
    {
        Order order = Session[FiveSistersCore.Cart] as Order;
        if (order.OrderDetails != null)
        {
            int sumitem = 0;
            int sumprice = 0;
            foreach (OrderDetail item in order.OrderDetails)
            {
                sumitem += item.Quantity;
                sumprice += item.PriceAtBuy * item.Quantity;
            }
            cart_totalItem.InnerText = sumitem.ToString();
            cart_totalPrice.InnerText = sumprice.ToString();
        }
    }
}